import axios from 'axios';

export default {
    /**
     * get 请求
     * @param url 接口路由
     * @returns {AxiosPromise<any>}
     */
    get(url, data, auth = true) {
        if (auth) {
            data.manager_merchant_id = localStorage.getItem('userid')
            return axios.get(url,{params:data});
        } else {
            return axios.get(url,{params:data});
        }
    },

    /**
     * post 请求
     *
     * @param url 接口路由
     * @param data 接口参数
     * @returns {AxiosPromise<any>}
     */
    post(url, data, auth = true) {
        if (auth) {
            data.manager_merchant_id = localStorage.getItem('userid')
            return axios.post(url, data);
        } else {
            return axios.post(url, data);
        }
    }
    
}